#! /usr/bin/perl

use strict;
use warnings;
#use Encode;

open my $nameF, "<", "重名法官.txt" or die "can't open < file: $!";
my %courtCount;
while(<$nameF>) {
		chomp;
		/.*?姓名: (.*?),.*?法院Id: ([0-9]*).*/;
		push(@{$courtCount{$2}}, $1);
}

while((my $k, my $v) = each %courtCount) {
		print "courtId[$k], 重名法官[@{$v}]\n";
}
